
import React from 'react'
import { Swiper } from 'antd-mobile';
import {getBanner} from '../request/app'
import Top from '../components/top'
import '../assets/css/mine.css'

class Home extends React.Component{
constructor(){
super()
this.state={
    inList:[],
    bannerList : [],
    user:{
         name:'名字',
         xixi:"完善资料让小U更懂您"
    }
}
}

componentDidMount(){
    console.log(getBanner());
    getBanner()
    .then((res)=>{
        console.log(res);
        if(res.code==200){
            console.log(res.list);
           this.setState({
            bannerList : res.list,
            inList:res.list,

           },
           ()=>{console.log(this.state);}
           )

            
        }
       
    })

console.log(this.state);


    let onn =JSON.parse(sessionStorage.getItem('xiaou')) 
    console.log(onn);
    if(onn){
        console.log(onn.nickname);
        this.setState({
            user:{
                 ...this.state.user,
            name:onn.nickname,
            xixi:onn.nickname+'个人信息'
            }
           
        })
    }
    ///////
   
   
}

tz(){
    window.open('/pon')
}
render(){
    const {inList,user} =this.state
return (<div className='mine'>
     <div className='top'>
         <Top/>
  
         <div className='top_om'>
             {/* 点击事件 */}
            我的
            
         </div>
         
         
    </div>
    {/*  */}
    <div className='center'>
        <div className='div_1'>
            <div className='left'>
                <div>
                    <img src={require('../assets/img/dui1.png')} alt="" />
                </div>
                <div>
                    <p>{user.name}</p>
                    <span>{user.xixi}</span>
                </div>
            </div>

<div className='right'>
    <img src={require('../assets/img/iconred_envelopes@3x.png')} alt="" />
    每日签到
</div>
        </div>
        {/*  */}

        <div className='div_2'>
            <div>
                <p>12</p>
                <div>我的收藏</div>
            </div>
            <div>
                <p>12</p>
                <div>浏览记录</div>
            </div>
            <div>
                <p>￥0</p>
                <div onClick={this.tz.bind()}>优惠卷</div>
            </div>
            <div>
                <p>12</p>
                <div>我的收藏</div>
            </div>

        </div>

        {/* 3 */}
        <div className='div_3'>
            <div className='Top_2'>
                <p>我的订单</p>
                <div>全部订单 &gt;</div>
            </div>
<div>
<div className='button'>
    <div>
          <img src={require('../assets/img/mine2.png')} alt="" />
    </div>
  <div>
    <img src={require('../assets/img/mine0.png')} alt="" />
</div>
<div>
    <img src={require('../assets/img/mine1.png')} alt="" />
</div>
<div>
    <img src={require('../assets/img/mine3.png')} alt="" />
</div>
</div>

</div>
        </div>


    </div>
    {/* 轮播图 */}
    <div className='banner'>
          
    <Swiper autoplay loop>{
    inList.map((item) => (
         <Swiper.Item key={item.id} className='content'>
        <img src={item.img} alt="" />
        </Swiper.Item>
      ))
    }
    
    </Swiper>

    </div>

    <div className='ondner'>
        <div>
            <img src={require('../assets/img/icon0.png')} alt="" />
            <p>地址管理</p>
        </div>
        <div>
            <img src={require('../assets/img/icon2.png')} alt="" />
            <p>我的钱包</p>
        </div>
        <div>
            <img src={require('../assets/img/icon4.png')} alt="" />
            <p>我的二维码</p>
        </div>
        <div>
            <img src={require('../assets/img/icon3.png')} alt="" />
            <p>我的小伙伴</p>
        </div>
        <div>
            <img src={require('../assets/img/icon1.png')} alt="" />
            <p>0元试用</p>
        </div>

    </div>

{/*  */}

<div className='list'>


</div>



</div>)
}
}
export default Home